package com.example.usercenter.controller.user;

import com.example.usercenter.dao.user.UserMapper;
import com.example.usercenter.domain.entity.user.User;
import com.example.usercenter.service.user.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author Zhang Yu
 * @description: TODO
 * @date 2024/5/15 10:55
 */
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))  //去除mapper报红的警告
@RequestMapping("/users")
@Slf4j
public class UserController {

    private final UserService userService;


    @GetMapping("/{id}")
    public User findById(@PathVariable Integer id) {
        log.info("我被请求了...");
        return userService.findById(id);
    }

    @GetMapping("/q")
    public User query(User user) {
        return user;
    }
}
